﻿<%@ Page Language="VB" debug="true" AutoEventWireup="false"  %>
<%@ import namespace="System" %>  
<%@ import namespace="System.Drawing" %>  
<%@ import namespace="System.Drawing.Imaging" %>  
<%@ import namespace="System.IO" %>  

<script runat="server">  
    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim g As System.Drawing.Image = System.Drawing.Image.FromFile("D:\Eigene Dateien\mastercms\entwicklung\admin\images\frontpage.jpg")
        Dim thisFormat As ImageFormat = g.RawFormat()

        Dim thumbSize As New Size
        thumbSize = NewthumbSize(g.Width, g.Height)

        Dim imgOutput As New Bitmap(g, thumbSize.Width, thumbSize.Height)
        If thisFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif) Then
            Response.ContentType = "image/gif"
        Else
            Response.ContentType = "image/jpeg"
        End If
        imgOutput.Save(Response.OutputStream, thisFormat) ' output to the user  
        g.Dispose()
        imgOutput.Dispose()
    End Sub
    
    Function NewthumbSize(ByVal currentwidth As Integer, ByVal currentheight As Integer) As Size
        Dim tempMultiplier As Double
        If currentheight > currentwidth Then ' portrait  
            tempMultiplier = 120 / currentheight
        Else
            tempMultiplier = 120 / currentwidth
        End If
        Dim NewSize As New Size(CInt(currentwidth * tempMultiplier), CInt(currentheight * tempMultiplier))
        Return NewSize
    End Function
</script>  

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server" ><title></title></head>
<body>
</body>	
</html>


